/*
Copyright [2023] [fuwen_soft]
*/
package vip.xiaonuo.modular.xylogy.controller;

import vip.xiaonuo.core.annotion.BusinessLog;
import vip.xiaonuo.core.annotion.Permission;
import vip.xiaonuo.core.enums.LogAnnotionOpTypeEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import vip.xiaonuo.core.pojo.page.PageResult;
import vip.xiaonuo.modular.xylogy.param.XyLogyParam;
import vip.xiaonuo.modular.xylogy.service.XyLogyService;
import vip.xiaonuo.modular.xylogy.entity.XyLogy;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.validation.annotation.Validated;
import vip.xiaonuo.core.annotion.version.AdminVersionSwagger;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import javax.annotation.Resource;
import java.util.List;
import vip.xiaonuo.sys.core.msg.Result;
import static vip.xiaonuo.sys.core.msg.ResultUtils.success;
/**
 * 族谱书控制器
 *
 * @author yanwei
 * @date 2023-05-05 15:44:28
 */
@RestController
@Api(tags = "后台管理 族谱书 相关APIS")
@AdminVersionSwagger
public class XyLogyController {

    @Resource
    private XyLogyService xyLogyService;

    /**
     * 查询族谱书
     *
     * @author yanwei
     * @date 2023-05-05 15:44:28
     */
    @Permission
    @GetMapping("/xyLogy/page")
    @BusinessLog(title = "族谱书_查询", opType = LogAnnotionOpTypeEnum.QUERY)
    @ApiOperation("族谱书_查询")
    public Result<PageResult<XyLogy>> page(XyLogyParam xyLogyParam) {
        PageResult<XyLogy> page = xyLogyService.page(xyLogyParam);
        return success(page);
    }

    /**
     * 添加族谱书
     *
     * @author yanwei
     * @date 2023-05-05 15:44:28
     */
    @Permission
    @PostMapping("/xyLogy/add")
    @BusinessLog(title = "族谱书_增加", opType = LogAnnotionOpTypeEnum.ADD)
    @ApiOperation("族谱书_增加")
    public Result add(@RequestBody @Validated(XyLogyParam.add.class) XyLogyParam xyLogyParam) {
            xyLogyService.add(xyLogyParam);
        return success();
    }

    /**
     * 删除族谱书，可批量删除
     *
     * @author yanwei
     * @date 2023-05-05 15:44:28
     */
    @Permission
    @PostMapping("/xyLogy/delete")
    @BusinessLog(title = "族谱书_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    @ApiOperation("族谱书_删除")
    public Result delete(@RequestBody @Validated(XyLogyParam.delete.class) List<XyLogyParam> xyLogyParamList) {
            xyLogyService.delete(xyLogyParamList);
        return success();
    }

    /**
     * 编辑族谱书
     *
     * @author yanwei
     * @date 2023-05-05 15:44:28
     */
    @Permission
    @PostMapping("/xyLogy/edit")
    @BusinessLog(title = "族谱书_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    @ApiOperation("族谱书_编辑")
    public Result edit(@RequestBody @Validated(XyLogyParam.edit.class) XyLogyParam xyLogyParam) {
            xyLogyService.edit(xyLogyParam);
        return success();
    }

    /**
     * 查看族谱书
     *
     * @author yanwei
     * @date 2023-05-05 15:44:28
     */
    @Permission
    @GetMapping("/xyLogy/detail")
    @BusinessLog(title = "族谱书_查看", opType = LogAnnotionOpTypeEnum.DETAIL)
    @ApiOperation("族谱书_查看")
    public Result<XyLogy> detail(@Validated(XyLogyParam.detail.class) XyLogyParam xyLogyParam) {
        XyLogy detail =   xyLogyService.detail(xyLogyParam);
        return success(detail);
    }

    /**
     * 族谱书列表
     *
     * @author yanwei
     * @date 2023-05-05 15:44:28
     */
    @Permission
    @GetMapping("/xyLogy/list")
    @BusinessLog(title = "族谱书_列表", opType = LogAnnotionOpTypeEnum.QUERY)
    @ApiOperation("族谱书_列表")
    public Result<List<XyLogy>> list(XyLogyParam xyLogyParam) {
        List<XyLogy> list  =   xyLogyService.list(xyLogyParam);
        return success(list);
    }

    /**
     * 导出系统用户
     *
     * @author yanwei
     * @date 2023-05-05 15:44:28
     */
    @Permission
    @GetMapping("/xyLogy/export")
    @BusinessLog(title = "族谱书_导出", opType = LogAnnotionOpTypeEnum.EXPORT)
    @ApiOperation("族谱书_导出")
    public void export(XyLogyParam xyLogyParam) {
        xyLogyService.export(xyLogyParam);
    }

}
